# -*- coding: utf-8 -*-
# @Time:2021/04/18 15:29
# @Author:Cindy
from time import sleep
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class AddMember(BasePage):

    def add_member(self, username, id, phone):
        from pages.contact_page import Contact
        self.driver.find_element(By.ID, "username").send_keys(username)
        self.driver.find_element(By.ID, "memberAdd_acctid").send_keys(id)
        self.driver.find_element(By.ID, "memberAdd_phone").send_keys(phone)
        self.driver.find_element(By.CSS_SELECTOR, ".js_member_editor_form>div:nth-child(1)>a:nth-child(2)").click()
        sleep(5)
        return Contact(self.driver)
